package com.ruoyi.jwxt.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.jwxt.utility.JwxtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/jwxt/utils")
public class JwxtUtilsController {

    @Autowired
    JwxtUtils jwxtUtils;

    /**
     * 获取当前全局学期（无缓存）
     */
    @GetMapping("/curSemester")
    public AjaxResult getCurSemester(){
        return AjaxResult.success(jwxtUtils.getCurSemester());
    }

    /**
     * 获取某角色的所有用户的<userId,userName>表单
     */
    @GetMapping("/getRoleList")
    public AjaxResult getRoleList(String target){
        return AjaxResult.success(jwxtUtils.getRoleList(target));
    }

    /**
     * 当前用户是（若依\教务）管理员吗
     */
    @GetMapping("/isAdmin")
    public AjaxResult isAdmin(){
        return AjaxResult.success(jwxtUtils.isAdmin());
    }
}
